// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie;

import gnu.trove.map.hash.TIntObjectHashMap;
import java.util.Stack;

public class IntArrayCache {
    public static zombie.IntArrayCache instance = new zombie.IntArrayCache();
    TIntObjectHashMap<Stack<Integer[]>> Map = new TIntObjectHashMap<>();

    public void Init() {
        for (int int0 = 0; int0 < 100; int0++) {
            Stack stack = new Stack();

            for (int int1 = 0; int1 < 1000; int1++) {
                stack.push(new Integer[int0]);
            }
        }
    }

    public void put(Integer[] integer) {
        if (this.Map.containsKey(integer.length)) {
            this.Map.get(integer.length).push(integer);
        } else {
            Stack stack = new Stack();
            stack.push(integer);
            this.Map.put(integer.length, stack);
        }
    }

    public Integer[] get(int size) {
        if (this.Map.containsKey(size)) {
            Stack stack = this.Map.get(size);
            if (!stack.isEmpty()) {
                return (Integer[])stack.pop();
            }
        }

        return new Integer[size];
    }
}
